package temple.timer;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author 滕贝
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2018/7/1310:44
 */
public class ThreadDemo {


    public static void main(String[] args) {
        new Timer().schedule(new MyTimerTask(), 2000);
        threadRun();
    }

    public static void threadRun(){
         new Thread(){
            @Override
            public void run() {
                while(true){
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("1:" + Thread.currentThread().getName());
                    this.setName("wolf");
                    System.out.println("2:" + this.getName());
                }
            }
        }.start();
    }
}
